package com.juzipi.demo.service;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.juzipi.demo.mapper.UserMapper;
import com.juzipi.demo.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserService {

    @Autowired
    private UserMapper userMapper;

    public Long queryUser(Integer pageNum, Integer pageSize) {
        Page<User> userPage = userMapper.selectPage(new Page<>(pageNum, pageSize), new QueryWrapper<User>().lambda().eq(User::getVersion,1).orderByAsc(User::getCreateTime));

        return userPage.getSize();
    }

    public void createUser(User user) {
        userMapper.insert(user);
    }
}
